__kernel
void cds_opencl(__global float *matrix, __const int rows, __const int diags, __global int *offsets, __global float *v, __global float *answer) {
  int row = get_global_id(0);
  float accumulator = 0;
  for(int diag = 0; diag < diags; diag++) {
    int col = row + offsets[diag];
    if ((col >= 0) && (col < rows)) {
      float m = matrix[diag*rows + row];
      float vec = v[col];
      accumulator += m * vec;
    }
  }
  answer[row] = accumulator;
}


